package com.api.base.utils;

import com.github.pagehelper.PageInfo;
import org.springframework.beans.BeanUtils;

import java.util.List;

/**
 * @author RenQiang
 * @date 2021/6/22
 */
public class PageInfoUtils {

    public static <S, T> PageInfo<T> convertPageInfo(PageInfo<S> sourcePageInfo, List<T> targetList) {
        PageInfo<T> targetPageInfo = new PageInfo<>();
        BeanUtils.copyProperties(sourcePageInfo, targetPageInfo);
        targetPageInfo.setList(targetList);
        return targetPageInfo;
    }
}
